<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改项目')" />
	<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-hxProject-edit" th:object="${hxProject}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
	    	 <div class="form-group">	
				<label class="col-xs-2 control-label">项目名称：</label>
				<div class="col-xs-3">
					<input class="form-control" th:field="*{proname}" id="proname" name="proname"  required />
				</div>
			    <label class="col-xs-2 control-label">项目负责人：</label>
				<div class="col-xs-3">
					<input id="manager" name="manager" th:field="*{manager}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-xs-2 control-label">项目类型：</label>
				<div class="col-xs-3">
					<select name="type" class="form-control m-b" th:with="type=${@dict.getType('hx_project_type')}">
				          <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{type}"></option>
	              </select>
				</div>
				<label class="col-xs-2  control-label">项目状态：</label>
				<div class="col-xs-3">
					<select name="status" class="form-control m-b" th:with="type=${@dict.getType('hx_project_status')}">
				          <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{status}"></option>
	              </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-xs-2 control-label">项目开始时间：</label>
				<div class="col-xs-3">
				 <div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                         <input type="text" class="form-control" id="startDate"  th:field="*{startDateStr}" required>
                  </div>
                   </div>
                   <label class="col-xs-2 control-label">项目结束时间：</label>
				<div class="col-xs-3">
				<div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                         <input type="text" class="form-control" id="endDate"  th:field="*{endDateStr}" required>
                  </div>
                  </div>
			</div>
<!-- 			<div class="form-group">	
				<label class="col-xs-2 control-label">项目参与成员：</label>
				<div class="col-xs-6" style="display: inline-flex;">
					<input id="participators" name="participators" th:field="*{participators}" type="text" hidden="true">
					<textarea class="form-control" th:field="*{participatorsName}"  id="participatorsName" name="participatorsName" rows="2" cols="" readonly="readonly" required></textarea>
					<button type="button" class="btn btn-info" onclick="selectUsersToParent()">选择成员</button>
				</div>
			</div> -->
			
			<div class="form-group">	
				<label class="col-xs-2 control-label">参与成员：</label>
				<div class="col-xs-6" style="display: inline-flex;">
					<textarea class="form-control" id="participators-view" th:field="*{participatorsName}" name="participators-view" rows="2" cols="" readonly="readonly" required></textarea>
					<input id="participators" name="participators" th:field="*{participators}" type="text" hidden="true">
					<button type="button" class="btn btn-info" onclick="selectUsersToParent()">选择成员</button>
				</div>
			</div>
			
	       <div class="form-group">	
				<label class="col-xs-2 control-label">项目描述：</label>
				<div class="col-xs-6">
					<textarea class="form-control" th:field="*{prodesc}"  id="prodesc" name="prodesc" rows="5" cols="" required></textarea>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
       <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
    $(function(){
    	
	    $("#startDate").datetimepicker({
	    		minView: "month", //选择日期后，不会再跳转去选择时分秒    
	    		format: "yyyy-mm-dd",
			    startView: 2,
			    todayBtn:  1,
		        todayHighlight: 1,
			    autoclose: true
			    
			});
	    
	    $("#endDate").datetimepicker({
	    	minView: "month",
		    format: "yyyy-mm-dd",
		    startView: 2,
		    todayBtn:  1,
	        todayHighlight: 1,
		    autoclose: true
		});
    });
    
    
		var prefix = ctx + "system/hxProject";
		$("#form-hxProject-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-hxProject-edit').serialize());
	        }
	    }
		
		function selectUsersToParent(){
			var participators = $('#participators').val();
			var participators_view = $('#participators-view').val();
			
			$.modal.open("选择用户", prefix + "/userListChoose?participators="+participators+"&participatorsName="+participators_view,900,400);
	    }
	</script>
</body>
</html>
